package user

import (
	"test_singo/models"
	"test_singo/utils"
)

type UserResonse struct {
	ID       uint   `json:"id"`
	UserName string `json:"username"`
	NickName string `json:"nickname"`
	Status   string `json:"status"`
	Avatar   string `json:"avatar"`
	CreateAt int64 `json:"create_at"`
}

func BuildUser(user models.User) UserResonse {
	return UserResonse{
		ID:       user.ID,
		UserName: user.Username,
		NickName: user.Nickname,
		Status:   user.Status,
		Avatar:   user.Avatar,
		CreateAt: user.CreatedAt.Unix(),
	}
}

func BuildUserResponse(user models.User) utils.Response {
	return utils.Response{
		Data: BuildUser(user),
	}
}
